package com.lanchetech.dao;
import java.util.Date;

import com.lanchetech.bean.request.BlogPageReq;
import com.lanchetech.bean.vo.BlogVO;
import com.lanchetech.bean.vo.StatisticsCountVO;
import com.lanchetech.entity.Blog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface BlogMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Blog record);

    int insertSelective(Blog record);

    Blog selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Blog record);

    int updateByPrimaryKey(Blog record);

    List<BlogVO> findAllPage(BlogPageReq req);

    int addGoods(Long id);

    int reduceGoods(Long id);

    int updateAuditStatusById(@Param("updatedAuditStatus") Byte updatedAuditStatus, @Param("id") Long id);

    int updateAuditStatusAndRemarkAndUpdatedAtById(@Param("updatedAuditStatus")Byte updatedAuditStatus,@Param("updatedRemark")String updatedRemark,@Param("updatedUpdatedAt")Date updatedUpdatedAt,@Param("id")Long id);

    int updateDeletedById(@Param("updatedDeleted") Byte updatedDeleted, @Param("id") Long id);

    List<Blog> findAllByIds(@Param("list") List<Long> ids);

    Blog findOneByUserIdAndAuditStatus(@Param("userId") Long userId, @Param("auditStatus") Byte auditStatus);

    List<Blog> findAllByFirstTagId(@Param("firstTagId") Long firstTagId);

    List<Blog> findAllByAuditStatusAndDeleted(@Param("auditStatus") Byte auditStatus, @Param("deleted") Byte deleted);

    List<StatisticsCountVO> countLikeSearch(@Param("search") String search);

    List<StatisticsCountVO> getTotalWordCount();

    List<StatisticsCountVO> getItemCount();

    List<StatisticsCountVO> getDisplayCount(@Param("search") String search);

    StatisticsCountVO getTotalWordCountByFirstTagId(@Param("firstTagId") Long firstTagId);

    StatisticsCountVO getItemCountByFirstTagId(@Param("firstTagId") Long firstTagId);
}